package com.spring.mvc.http.test;

import java.io.IOException;

import org.apache.commons.httpclient.HttpClient;
import org.apache.commons.httpclient.HttpException;
import org.apache.commons.httpclient.HttpStatus;
import org.apache.commons.httpclient.methods.GetMethod;


public class Client {
	
	private static final String URL_LOGIN="https://spuser.bestpay.com.cn/spuserweb/login.jsp";

	public Client() {
		HttpClient client=new HttpClient();
		GetMethod getMethod=null;
		getMethod=new GetMethod(URL_LOGIN);
		try {
			int statusCode=client.executeMethod(getMethod);
			if(statusCode==HttpStatus.SC_OK){
				System.out.println(getMethod.getResponseBodyAsString());
			}
		} catch (HttpException e) {
			e.printStackTrace();
		} catch (IOException e) {
			e.printStackTrace();
		} finally{
			if(null != getMethod){
				getMethod.releaseConnection();
				getMethod=null;
			}
		}
	}
	
	public static void main(String[] args) {
		new Client();
	}
}
